import mongoose from 'mongoose'

mongoose.connect('mongodb://localhost:27017/keqing-screeps')

const mgdb = mongoose.connection
const Schema = mongoose.Schema
const model = mongoose.model
mgdb.on('error', console.error.bind(console, '数据库连接失败'))
mgdb.once('open', function () {
    console.log('数据库连接成功')
})

export { mgdb, Schema, model }
